"""backends URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.urls import re_path as url
from rest_framework import routers
from django.views.static import serve
from backends import settings
from faceapp.views import FaceViewSet
from szwapp.views import SzwViewSet
from cameraapp.views import CameraViewSet
import nlpapp
from analyseapp.views import AnalyseViewSet


router = routers.DefaultRouter()

router.register(r'face', FaceViewSet)
router.register(r'szw', SzwViewSet)
router.register(r'camera', CameraViewSet)
router.register(r'analyse', AnalyseViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    path("admin/", admin.site.urls),
    path('', include(router.urls)),
    path("nlp/", include('nlpapp.urls')),
    # 暴露静态文件
    url('^media/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}),
    # url(r'recorder/(?P<path>.*)$', serve, {"document_root": settings.MEDIA_ROOT}),
    # url(r'^audio/(?P<path>.*)$', serve, {"document_root": settings.MEDIA_ROOT}),
]
